package com.demo.component;

import org.springframework.beans.factory.BeanNameAware;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

@Component
public class BeanLifeComponent implements BeanNameAware {

    @Override
    public void setBeanName(String s) {
        System.out.println("执行了BeanName的通知方法");
    }

    @PostConstruct
    public void postConstruct() {
        System.out.println("执行了初始化方法");
    }

    public void useBean() {
        System.out.println("使用了Bean对象");
    }

}
